import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MySalesInterface extends JFrame {
    public MySalesInterface() {
        setTitle("二手交易平台 - 我卖的");
        setSize(400, 700);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        
        // 主面板
        JPanel mainPanel = new JPanel();
        mainPanel.setLayout(new BorderLayout());
        
        // 顶部时间显示
        JPanel topPanel = new JPanel(new BorderLayout());
        topPanel.add(new JLabel("9:41"), BorderLayout.WEST);
        mainPanel.add(topPanel, BorderLayout.NORTH);
        
        // 标题和编辑按钮
        JPanel titlePanel = new JPanel(new BorderLayout());
        titlePanel.add(new JLabel("我卖的"), BorderLayout.WEST);
        JButton editButton = new JButton("编辑");
        titlePanel.add(editButton, BorderLayout.EAST);
        
        // 分类标签
        JTabbedPane tabbedPane = new JTabbedPane();
        tabbedPane.addTab("全部", new JPanel());
        tabbedPane.addTab("进行中", new JPanel());
        tabbedPane.addTab("已完成", new JPanel());
        tabbedPane.addTab("已关闭", new JPanel());
        
        // 商品信息
        JPanel productPanel = new JPanel(new BorderLayout());
        productPanel.add(new JLabel("二易集团收"), BorderLayout.NORTH);
        productPanel.add(new JLabel("vivo iQ00 11 Pro"), BorderLayout.CENTER);
        
        // 操作按钮
        JPanel actionPanel = new JPanel(new GridLayout(1, 2, 10, 10));
        actionPanel.add(new JButton("联系客服"));
        actionPanel.add(new JButton("重新估价"));
        
        // 返回按钮
        JButton backButton = new JButton("返回主界面");
        
        // 组装主界面
        JPanel contentPanel = new JPanel();
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
        contentPanel.add(titlePanel);
        contentPanel.add(tabbedPane);
        contentPanel.add(productPanel);
        contentPanel.add(actionPanel);
        contentPanel.add(backButton);
        
        mainPanel.add(contentPanel, BorderLayout.CENTER);
        add(mainPanel);
        
        // 添加按钮事件
        backButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new MainInterface().setVisible(true);
                dispose();
            }
        });
    }
}